package com.stylefeng.guns.modular.vpn.timer;

import com.stylefeng.guns.modular.vpn.utils.ConnectUtil;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

/**
 * 业务数据统计定时任务
 */
@Slf4j
public class DisConnectionQuartzJob implements Job {
    @Autowired
    @Qualifier("connectUtil")
    ConnectUtil connectUtil;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("进行任务的处理");
        log.info("断开超过24小时的所有连接，任务开始处理>>>>>>>>>>>>>>>>>>");
        try {
            connectUtil.disAllConnections();
        } catch (Exception e) {
            log.error("断开超过24小时的所有连接，任务失败  {}",e.getMessage());
            e.printStackTrace();
        }
        log.info("断开超过24小时的所有连接，任务处理完成<<<<<<<<<<<<<<<<<<<<<<<");
    }
}
